package com.woniuxy01;

import java.io.*;

/**
 * @author 作者
 * @create 2025-06-11 9:40
 */
//是你（继承）还有你（包含），一切拜托你
class Coffee{
    public String getCoffee(){
        return "coffee";
    }
}
class MiklCoffee extends Coffee{
    Coffee coffee;

    public MiklCoffee(Coffee coffee) {
        this.coffee = coffee;
    }

    public String getCoffee(){
        return "milk "+coffee.getCoffee();
    }
}
class SugarCoffee extends Coffee{
    Coffee coffee;

    public SugarCoffee(Coffee coffee) {
        this.coffee = coffee;
    }

    public String getCoffee(){
        return "sugar "+coffee.getCoffee();
    }
}
class SaltCoffee extends Coffee{
    Coffee coffee;

    public SaltCoffee(Coffee coffee) {
        this.coffee = coffee;
    }

    public String getCoffee(){
        return "salt "+coffee.getCoffee();
    }
}


public class Test08 {
    public static void main(String[] args) throws FileNotFoundException {
        Coffee coffee = new Coffee();
        System.out.println(coffee.getCoffee());

        MiklCoffee coffee1 = new MiklCoffee(coffee);
        System.out.println(coffee1.getCoffee());

        System.out.println(new SaltCoffee(coffee).getCoffee());

        System.out.println(new SugarCoffee(coffee1).getCoffee());


        new BufferedReader(new InputStreamReader(new FileInputStream("a.txt")));
        new BufferedReader(new InputStreamReader(new BufferedInputStream(new FileInputStream("a.txt"))));

        new SaltCoffee(new SugarCoffee(new Coffee()));
    }
}
